package com.it;

import java.io.*;
import java.util.Properties;

public class cmd {
    public static void main(String[] args) throws IOException {
        Properties properties = new Properties();
        //指定配置文件的路径
        properties.load(new FileInputStream("src/main/resources/application.properties"));
        //获取配置文件的value
        String property = properties.getProperty("clean-mark");
        try {
            //调用Linux的相关命令
            Process p = Runtime.getRuntime().exec("clean-mark " + property);
            InputStreamReader ir = new InputStreamReader(p.getInputStream());
            //创建IO管道，准备输出命令执行后的显示内容
            LineNumberReader input = new LineNumberReader(ir);
            String line;
            while ((line = input.readLine()) != null) {
                //按行打印输出内容
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
